package cn.est.exception;

import cn.est.dto.Result;
import cn.est.excepting.BizExcepting;
import cn.est.util.ResultUtil;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class ExceptionAdvice {

    @ExceptionHandler
    @ResponseBody
    public Result handleException(BizExcepting exception){
        return ResultUtil.error(exception.getCode(),exception.getMessage());
    }
}
